﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SmsSyncServer
{
    public partial class Passcode : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var lastUpdate = this.Session["Update"];
            if (lastUpdate != null && DateTime.Now - (DateTime)lastUpdate < TimeSpan.FromMinutes(5))
            {
                this.Response.Redirect("show.aspx");
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (this.input.Text == Properties.Settings.Default.Secret)
            {
                this.Session["Update"] = DateTime.Now;
                this.Response.Redirect("show.aspx");
            }
        }
    }
}